From b7e29a3d67e3e214ba1c958478092ee4075e8171 Mon Sep 17 00:00:00 2001 From: real-zephex Date: Thu, 4 Apr 2024 23:00:53 +0530 Subject: inmidst of rewriting the kdrama section. will complete it soon --- src/app/kdrama/[id]/page.jsx | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/app/kdrama/[id]/page.jsx (limited to 'src/app/kdrama/[id]/page.jsx') diff --git a/src/app/kdrama/[id]/page.jsx b/src/app/kdrama/[id]/page.jsx new file mode 100644 index 0000000..cd3af74 --- /dev/null +++ b/src/app/kdrama/[id]/page.jsx @@ -0,0 +1,60 @@ +import styles from "../styles/info.module.css"; +import Image from "next/image"; +export default async function DramaInfo({ params }) { + const id = decodeURIComponent(params.id); + const info = await getDramaInfo(id); + + return ( +
+ {info && ( +
+
+

{info.title}

+ Drama Poster +
+ +
+

Description

+

{info.description}

+
+ + {/* Genres */} +
+ Genres: + {info.genres && + info.genres.map((item, index) => ( + + {item} + + ))} +
+ + {/* Other names */} +
+ AKA: + {info.otherNames && + info.otherNames.map((item, index) => ( + + {item} + + ))} +
+
+ )} +
+ ); +} + +async function getDramaInfo(id) { + const res = await fetch( + `https://consumet-api-di2e.onrender.com/movies/dramacool/info?id=${id}` + ); + const data = await res.json(); + return data; +} -- cgit v1.2.3 From 381a1cb5c14270d9bdc8cd56f17c75d79df231de Mon Sep 17 00:00:00 2001 From: real-zephex Date: Fri, 5 Apr 2024 09:57:47 +0530 Subject: added caching and video player --- src/app/kdrama/[id]/page.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/app/kdrama/[id]/page.jsx') diff --git a/src/app/kdrama/[id]/page.jsx b/src/app/kdrama/[id]/page.jsx index cd3af74..c891a0b 100644 --- a/src/app/kdrama/[id]/page.jsx +++ b/src/app/kdrama/[id]/page.jsx @@ -1,9 +1,14 @@ import styles from "../styles/info.module.css"; import Image from "next/image"; +import EpisodesButtons from "./buttons"; +import VideoLinkCacher from "../components/cacher"; + export default async function DramaInfo({ params }) { const id = decodeURIComponent(params.id); const info = await getDramaInfo(id); + await VideoLinkCacher(info.episodes, id); + return (
{info && ( @@ -19,6 +24,7 @@ export default async function DramaInfo({ params }) { />
+ {/* Drama description */}

Description

{info.description}

@@ -45,6 +51,9 @@ export default async function DramaInfo({ params }) { ))}
+ + {/* Episodes Buttons */} + )} @@ -53,7 +62,8 @@ export default async function DramaInfo({ params }) { async function getDramaInfo(id) { const res = await fetch( - `https://consumet-api-di2e.onrender.com/movies/dramacool/info?id=${id}` + `https://consumet-api-di2e.onrender.com/movies/dramacool/info?id=${id}`, + { next: { revalidate: 86400 } } ); const data = await res.json(); return data; -- cgit v1.2.3 From 0c7581bb601b748bdb54ba9496b32a34f30c1abe Mon Sep 17 00:00:00 2001 From: real-zephex Date: Sat, 6 Apr 2024 15:31:11 +0530 Subject: added search functionality --- src/app/kdrama/[id]/page.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/app/kdrama/[id]/page.jsx') diff --git a/src/app/kdrama/[id]/page.jsx b/src/app/kdrama/[id]/page.jsx index c891a0b..baaf24e 100644 --- a/src/app/kdrama/[id]/page.jsx +++ b/src/app/kdrama/[id]/page.jsx @@ -1,13 +1,13 @@ import styles from "../styles/info.module.css"; import Image from "next/image"; import EpisodesButtons from "./buttons"; -import VideoLinkCacher from "../components/cacher"; +import PreFetchVideoLinks from "../components/cacher"; export default async function DramaInfo({ params }) { const id = decodeURIComponent(params.id); const info = await getDramaInfo(id); - await VideoLinkCacher(info.episodes, id); + PreFetchVideoLinks(info.episodes, id); return (
-- cgit v1.2.3